﻿using System.Collections.Generic;
using System.Net;

namespace ETModel
{
    /// <summary>
    /// actor定位发送器,用Id向定位服务器获得intanceId,再用ActorMessageSender发送
    /// 自己的Id需要为要查找的Id
    /// (知道对方的Id，使用这个类发actor消息)
    /// </summary>
    public class ActorLocationSender : ComponentWithId
	{
		// actor的地址
		public IPEndPoint Address;

		public long ActorId;
		
		// 还没发送的消息
		public Queue<ActorTask> WaitingTasks = new Queue<ActorTask>();

		// 最近发送消息的时间
		public long LastSendTime;
		
		public int FailTimes;

		public const int MaxFailTimes = 5;
		
		public ETTaskCompletionSource<ActorTask> Tcs;

		public override void Dispose()
		{
			if (this.IsDisposed)
			{
				return;
			}
			
			base.Dispose();
		}
	}
}